 /// @file InterOpPMIDatum.h
 /// @brief InterOpPMIDatum 
 /// @copyright Copyright (c) 2025  Hefei Jiushao Intelligent Technology Co., Ltd. All rights reserved.
 /// @createtime 2025-04-07

#ifndef INTEROPPMIDATUM_H
#define INTEROPPMIDATUM_H
#include "InterOpPMIBase.h"
#include "vector"
#include <memory>

namespace  AMCAX::Exchange::InterOp::PMI {

enum class PMIDatumTargetType
{
    Unknown,
    Point,
    Line,
    AreaCircular,
    AreaRectangular,
    AreaFace,
    Feature,
    UserDefined
} ;

#define IS_InterOpPMIDatumTarget(BasePtr) IS_DERIVED_SHARED_PTR(BasePtr, AMCAX::Exchange::InterOp::PMI::InterOpPMIDatumTarget)
#define Cast_InterOpPMIDatumTarget(BasePtr) SAFE_SHARED_PTR_CAST(BasePtr, AMCAX::Exchange::InterOp::PMI::InterOpPMIDatumTarget)
class InterOpPMIDatumTarget : public InterOpPMIAnnotation
{
public:
    PMIAnnotationType GetType() const override
	{
		return PMIAnnotationType::DatumTarget;
	} 
    
    void SetLabel(const std::string &l){
        this->label = l ; 
    } ;
    void SetTargetType(const PMIDatumTargetType &t){
        this->targetType = t ; 
    } ;
    void SetHasDiameter(bool hasDiameter){
        this->hasDiameter = hasDiameter ; 
    } ;
    void SetUpperText(const std::string &ut){
        this->upperText = ut ; 
    } ;
    void SetLowerText(const std::string &lt){
        this->lowerText = lt ; 
    } ;
    void SetPosition1(float x, float y, float z){
        this->position1[0] = x ; 
        this->position1[1] = y ; 
        this->position1[2] = z ; 
    } ;
    void SetPosition2(float x, float y, float z){
        this->position2[0] = x ; 
        this->position2[1] = y ; 
        this->position2[2] = z ; 
    } ;
    const std::string& GetLabel() const {
        return label;
    }

    PMIDatumTargetType GetTargetType() const {
        return targetType;
    }

    bool GetHasDiameter() const {
        return hasDiameter;
    }

    const std::string& GetUpperText() const {
        return upperText;
    }

    const std::string& GetLowerText() const {
        return lowerText;
    }

    const float* GetPosition1() const {
        return position1;
    }

    const float* GetPosition2() const {
        return position2;
    }
private:
    std::string label ;
    PMIDatumTargetType targetType ;
    bool hasDiameter ;
    std::string upperText ;
    std::string lowerText ;
    float position1[3] ;
    float position2[3] ;
} ;

#define IS_PMIInterOpDatum(BasePtr) IS_DERIVED_SHARED_PTR(BasePtr, AMCAX::Exchange::InterOp::PMI::PMIInterOpDatum)
#define Cast_PMIInterOpDatum(BasePtr) SAFE_SHARED_PTR_CAST(BasePtr, AMCAX::Exchange::InterOp::PMI::PMIInterOpDatum)
class PMIInterOpDatum : public InterOpPMIAnnotation
{  
public:
    PMIAnnotationType GetType() const override
	{
		return PMIAnnotationType::Datum;
	} 

    void SetLabel(const std::string &l){
        this->label = l ; 
    } ;

    void AddDatumTarget(const std::shared_ptr<InterOpPMIDatumTarget> &datumTarget){
        this->datumTargets.push_back(datumTarget) ;
    } ;

    const std::string& GetLabel() const {
        return label;
    }

    const std::vector<std::shared_ptr<InterOpPMIDatumTarget>>& GetDatumTargets() const {
        return datumTargets;
    }

private:
    std::string label ;
    std::vector<std::shared_ptr<InterOpPMIDatumTarget>> datumTargets ;
} ;

}

#endif